package team.common.utility;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.apache.commons.configuration.ConfigurationException;

import team.common.config.ConfigManager;

public class ContextListener implements ServletContextListener 
{
	
	/**
	 * @param event
	 */
	public void contextInitialized(ServletContextEvent event) {
    	ServletContext sc = event.getServletContext();
    	ConfigManager cm = null;
    	
    	//common.properties 
    	String commonPpropertyFilePath = sc.getRealPath("/") + "/WEB-INF/properties/common.properties";
    	try {
    		ConfigManager.init(commonPpropertyFilePath);
    		cm = ConfigManager.getInstance();
    	} catch (ConfigurationException e) {
    		e.printStackTrace();
		}
	}
	
	/**
	 * @param event 
	 */
	public void contextDestroyed(ServletContextEvent event) {
	}
}
